package edu.nyu.hps.assignment5;

public class Blue extends Voronoi {

	public Blue(int p, int s) {
		time = 120;
		player = p;
		stones = s;
		diameter = (Math.sqrt(2)*501/2);
		for (int i = 0; i < 501; i++) {
			for (int j = 0; j < 501; j++) {
				grid[i][j] = new Point(i, j);
			}
		}
	}
	
	@Override
	public void updateArea() {
		myMyArea = 0;
		myOpponentArea = 0;
		for(int i=0;i<501;i++){
			for(int j=0;j<501;j++){
				if(grid[i][j].takenBy == 1)
					myMyArea+=1;
				else
					myOpponentArea+=1;
			}
		}
		
		center = grid[250][250];
	}

	public Point strategy1(){
		Point opp = opponentStones.get(opponentStones.size()-1);
		int i=501-opp.x;
		int j=501-opp.y;
		while(true){
			if(!grid[i][j].taken){
				myStones.add(grid[i][j]);
				grid[i][j].taken = true;
				return grid[i][j];
			}
			i+=10;
			j+=10;
		}
	}
		
	public Point strategy2(){
		Moves m = new Moves();
		m.createSquare();
		return m.computeBestPoint();
	}
	
	@Override
	public Point throwAt() {
//		double area,bestArea = 0;
//		Point bestPoint = null;
		updatesBeforeComputing();
//		if(opponentStones.size()/2 < stones/2 -2){	
//			return strategy1();
//		}
//		else 
			return strategy2();
	}
}
